package service.impl;

import dao.StudentDao;
import dao.impl.StudentDaoImpl;
import domain.Student;
import service.StudentService;

import java.util.ArrayList;

public class StudentServiceImpl implements StudentService {
    private StudentDao dao = new StudentDaoImpl();

    /**
     * 查询所有
     * @return
     */

    @Override
    public ArrayList<Student> findAll() {
        return dao.findAll();
    }

    /**
     * 根据Id查询
     * @param id
     * @return
     */
    @Override
    public Student findById(Integer id) {
        return  dao.findById(id);
    }

    /**
     * 增加数据
     * @param student
     * @return
     */
    @Override
    public int insert(Student student) {
        return dao.insert(student);
    }

    /**
     * 删除数据
     * @param id
     * @return
     */
    @Override
    public int delete(Integer id) {
        return dao.delete(id);

    }

    /**
     * 修改数据据
     * @param student
     * @return
     */
    @Override
    public int update(Student student) {
        return dao.update(student);
    }
}
